﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.GateUI {
    import flash.display.*;
    import Display.DialogUI.*;
    import org.aswing.*;
    import Classes.*;
    import org.aswing.geom.*;
    import org.aswing.ext.*;
    import Display.aswingui.*;

    public class CrewCell_2 extends CrewCell {

        private const CELL_WIDTH:int = 550;
        private const CELL_HEIGHT:int = 56;

        protected var m_layoutInfoPanel:Function;
        protected var m_color:int;
        protected var m_imagePanel2:JPanel;
        protected var m_infoPanel2:JPanel;

        public function CrewCell_2(_arg1:CrewCellFactory_2, _arg2:int, _arg3:LayoutManager=null){
            this.m_color = _arg2;
            super(_arg1, _arg3);
        }
        public function get position():String{
            if (m_cellData == null){
                return ("");
            };
            if ((m_cellData is String)){
                return ("");
            };
            return (m_cellData.name);
        }
        public function get friendName():String{
            if (m_cellData == null){
                return (null);
            };
            if ((m_cellData is String)){
                return (null);
            };
            return (m_cellData.friendName);
        }
        override public function setGridListCellStatus(_arg1:GridList, _arg2:Boolean, _arg3:int):void{
            if (_arg1){
                _arg1.setTileWidth(this.CELL_WIDTH);
                _arg1.setTileHeight(this.CELL_HEIGHT);
                this.layoutCell();
            };
        }
        override protected function initBackground():void{
            m_size = new IntDimension(this.CELL_WIDTH, this.CELL_HEIGHT);
            this.setMinimumSize(m_size);
            this.setPreferredSize(m_size);
            this.setMaximumSize(m_size);
            var _local1:Sprite = new Sprite();
            if ((this.m_color % 2) == 1){
                _local1.graphics.beginFill(EmbeddedArt.whiteTextColor);
            } else {
                _local1.graphics.beginFill(EmbeddedArt.lightBlueTextColor);
            };
            _local1.graphics.drawRect(0, 0, this.CELL_WIDTH, this.CELL_HEIGHT);
            _local1.graphics.endFill();
            ASwingHelper.setBackground(this, _local1);
        }
        override public function setCellValue(_arg1):void{
            super.setCellValue(_arg1);
            this.buildCell();
            this.layoutCell();
        }
        override public function buildCell():void{
            this.initBackground();
            if (this.position.length > 0){
                this.m_imagePanel2 = makeImagePanel();
            } else {
                this.m_imagePanel2 = null;
            };
            this.m_infoPanel2 = this.makeInfoPanel();
        }
        override protected function makeInfoPanel():JPanel{
            var _local4:JTextField;
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.LEFT);
            if ((m_cellData is String)){
                return (_local1);
            };
            var _local2:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            var _local3:JTextField = ASwingHelper.makeTextField((this.position.toUpperCase() + " "), EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 14, EmbeddedArt.darkBlueTextColor);
            if (this.friendName){
                _local4 = ASwingHelper.makeTextField((this.friendName + " "), EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 12, EmbeddedArt.darkBrownTextColor);
            } else {
                _local4 = ASwingHelper.makeTextField((ZLoc.t("Dialogs", "EmptyCrewCell") + " "), EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 12, EmbeddedArt.blueTextColor);
            };
            _local2.appendAll(_local3, _local4);
            _local1.append(_local2);
            return (_local1);
        }
        override public function layoutCell():void{
            this.removeAll();
            ASwingHelper.prepare(this.m_imagePanel2, this.m_infoPanel2);
            this.appendAll(this.m_imagePanel2, this.m_infoPanel2);
            ASwingHelper.prepare(this);
        }

    }
}//package Display.GateUI 
